<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>技术</title>
    <link rel="stylesheet" href="layui/css/layui.css">
    <link rel="stylesheet" href="css/home.css">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=2.0, user-scalable=yes"/>
</head>
<body>

<div id="header">
    <div class="nav">
        <a href="#" class="logo">Lee Blog</a>
        <div id="nav-btn" class="btn">
            <i id="btn" class="layui-icon layui-icon-addition"></i>
        </div>
        <ul class="nav-bar">
            <li><a href="home.html" th:href="@{/home}">首页</a></li>
            <li class="active"><a href="technology.html" th:href="@{/technology}">技术</a></li>
            <li><a href="life.html" th:href="@{/life}">杂记</a></li>
            <li><a href="time.html" th:href="@{/time}">时间轴</a></li>
            <li><a href="message.html" th:href="@{/message}">留言</a></li>
            <li><a href="about.html" th:href="@{/about}">关于我</a></li>
        </ul>
    </div>
</div>

<div class="layui-fluid btn-nav">
    <ul>
        <li><a href="home.html" th:href="@{/home}">首页</a></li>
        <li class="active"><a href="technology.html" th:href="@{/technology}">技术</a></li>
        <li><a href="life.html" th:href="@{/life}">杂记</a></li>
        <li><a href="time.html" th:href="@{/time}">时间轴</a></li>
        <li><a href="message.html" th:href="@{/message}">留言</a></li>
        <li><a href="about.html" th:href="@{/about}">关于我</a></li>
    </ul>
</div>

<div class="layui-fluid title">
    <h1>技术</h1>
    <p>真正危险的不是计算机像人一样思考，而是人类开始像计算机一样思考。</p>
</div>

<div id="main" class="layui-fluid">
    <div class="layui-row">
        <div id="main-left" class="layui-col-sm7 layui-col-sm-offset1">

            <div class="article-item layui-anim layui-anim-up" th:each="article : ${technologyArticle}">
                <a th:href="@{/articleDetail(id=${article.id})}"><h2 class="articleTitle" th:text="${article.title}">Java从入门到精通</h2></a>
                <p class="articleDesc" th:text="${article.desc}">全网最好的Java入门课程，让你从年头学到年尾！</p>
                <i class="layui-icon layui-icon-time articleTime" th:text="${article.time}"> 2020年3月24日</i>
                <i class="layui-icon layui-icon-template-1 articleType" th:text="${article.type}">技术</i>
                <i class="layui-icon layui-icon-note articleLabel" th:text="${article.label}"> Java</i>
            </div>

        </div>
        <div id="main-right" class="layui-col-sm3">
            <div class="box layui-anim layui-anim-upbit">
                <i class="layui-icon layui-icon-note"> 文章标签</i><br>
                <div class="note">
                    <a href="#" class="labelBtn" th:each="label : ${allLabel}"><i class="layui-icon layui-icon-note icon-item" th:text="${label}"> Java</i></a>
                </div>
            </div>
        </div>
    </div>
</div>

<div id="footer"><a href="http://www.beian.miit.gov.cn/">Copyright © 2020 LeeBlog 鄂ICP备20013163号</a></div>


<script src="js/jquery-3.4.1.js"></script>
<script src="js/function.js"></script>
<script src="layui/layui.js"></script>
<script src="js/home.js"></script>
<script src="js/jquery.rotate.min.js"></script>
<script>
    layui.use(["jquery"],function () {
        var $ = layui.jquery;
        $(".labelBtn").click(function () {
            var label = $(this).children().text();
            $.ajax({
                url: "getArticleByLabel",
                data: {"label" : label},
                dataType: "json",
                success : function (data) {
                    console.log(data);
                    var html = "";
                    for (var i = 0; i < data.length; i++){
                        html +=
                            "<div class=\"article-item layui-anim layui-anim-up\">" +
                            "<a href=\"/articleDetail?id=" + data[i].id + "\"><h2 class=\"articleTitle\"> " + data[i].title + "</h2></a>\n" +
                            "<p class=\"articleDesc\" th:text=\"${article.desc}\">" + data[i].desc + "</p>\n" +
                            "<i class=\"layui-icon layui-icon-time articleTime\" th:text=\"${article.time}\">" + data[i].time + "</i>\n" +
                            "<a href=\"\"><i class=\"layui-icon layui-icon-template-1 articleType\" th:text=\"${article.type}\">" + data[i].type + "</i></a>\n" +
                            "<a href=\"\"><i class=\"layui-icon layui-icon-note articleLabel\" th:text=\"${article.label}\">" + data[i].label + "</i></a>" +
                            "</div>";

                    }
                    $("#main-left").html(html);
                }
            })
        })
    })
</script>
</body>
</html>